package part17;

import java.util.LinkedHashMap;

/**
 * @author wcj
 * @Date 2021/6/1 20:00
 * @Version 1.0
 */
public class Part1713 {

    /**
     * LinkedHashMap:保证元素的顺序，还能够使用LRU策略将近期访问过的元素放置到末尾处
     *
     * @param args
     */
    public static void main(String[] args) {
        LinkedHashMap<Integer, String> map = new LinkedHashMap<>();
        map.put(0, "bss");
        map.put(1, "wcj");
        map.put(2, "ysj");
        map.put(3, "ylb");
        map.put(4, "wgp");
        System.out.println(map);

        map = new LinkedHashMap<>(16, 0.75f, true);
        System.out.println(map);
        map.put(0, "bss");
        map.put(1, "wcj");
        map.put(2, "ysj");
        map.put(3, "ylb");
        map.put(4, "wgp");
        System.out.println(map);
        map.get(2);
        System.out.println(map);
    }
}
